//
//  CertificateDetailTopTableViewCell.m
//  WideHelp
//
//  Created by ENERGY on 2018/8/13.
//  Copyright © 2018年 ENERGY. All rights reserved.
//

#import "CertificateDetailTopTableViewCell.h"

@interface CertificateDetailTopTableViewCell()
@property (nonatomic, strong)UILabel * titleLab;
@property (nonatomic, strong)UILabel * contentLab;
@end

@implementation CertificateDetailTopTableViewCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = [UIColor whiteColor];
        __weak typeof (self)weakSelf = self;
        [self.contentView addSubview:self.titleLab];
        [self.contentView addSubview:self.contentLab];
        [self.contentView addSubview:self.lineView];
        [self.titleLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.contentView.mas_left).mas_offset(15/WIDTH_6_SCALE);
            make.top.equalTo(weakSelf.contentView);
            make.bottom.equalTo(weakSelf.lineView.mas_top);
        }];
        [self.contentLab mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(weakSelf.contentView.mas_right).mas_offset(-15/WIDTH_6_SCALE);
            make.top.bottom.equalTo(weakSelf.titleLab);
        }];
        [self.lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(weakSelf.contentView.mas_left).mas_offset(15/WIDTH_6_SCALE);
            make.right.bottom.equalTo(weakSelf.contentView);
            make.height.mas_offset(1/WIDTH_6_SCALE);
        }];
    }return self;
}
- (UILabel *)titleLab{
    if (!_titleLab) {
        _titleLab = [[UILabel alloc] init];
        _titleLab.font = DEF_FontSize_14;
        _titleLab.textColor = [UIColor blackColor];
        _titleLab.textAlignment = NSTextAlignmentLeft;
    }return _titleLab;
}
- (UILabel *)contentLab{
    if (!_contentLab) {
        _contentLab = [[UILabel alloc] init];
        _contentLab.font = DEF_FontSize_12;
        _contentLab.textColor = getColor(@"9b9b9b");
        _contentLab.textAlignment = NSTextAlignmentRight;
    }return _contentLab;
}
- (UIView *)lineView{
    if (!_lineView) {
        _lineView = [[UIView alloc] init];
        _lineView.backgroundColor = getColor(@"eeeeee");
    }return _lineView;
}
- (void)setModel:(NSDictionary *)model{
    _model = model;
    self.titleLab.text = model[@"title"];
    self.contentLab.text = model[@"content"];
}
@end
